package cn.cloudreal.cbms.mediaPrice.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.poi.POIXMLDocument;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.struts2.ServletActionContext;

import cn.cloudreal.cbms.Dictionary.service.DictionaryService;
import cn.cloudreal.cbms.common.util.BaseDAO;
import cn.cloudreal.cbms.common.util.Constants;
import cn.cloudreal.cbms.common.util.DatadicContext;
import cn.cloudreal.cbms.common.util.StringUtils;
import cn.cloudreal.cbms.contract.service.ContractListService;
import cn.cloudreal.cbms.levelRule.service.LevelRuleService;
import cn.cloudreal.cbms.mediaPrice.service.MediaPriceService;
import cn.cloudreal.cbms.mediasumm.service.MediasummService;
import cn.cloudreal.cbms.medium.service.MediumService;
import cn.cloudreal.cbms.vo.Contract;
import cn.cloudreal.cbms.vo.Dictionary;
import cn.cloudreal.cbms.vo.LevelRule;
import cn.cloudreal.cbms.vo.MediaPrice;
import cn.cloudreal.cbms.vo.Mediasumm;
import cn.cloudreal.cbms.vo.Medium;
import cn.cloudreal.cbms.vo.UserInfo;

import com.opensymphony.xwork2.ActionSupport;

/**
 * <p>
 * Title: CBM
 * </p>
 * <p>
 * Description:媒体刊例批量导入
 * </p>
 * <p>
 * Copyright: Copyright (c) 2012
 * </p>
 * <p>
 * Company:云恒瑞通
 * </p>
 * 
 * @author liupanpan
 * @date 2012-08-09
 */
public class UploadMediaAction extends ActionSupport {

	private DictionaryService dictionaryService = null;// 数据字典Service
	private ContractListService contractListService = null; // 合同service
	private MediaPriceService mediaPriceService = null; // 媒体价格service
	private MediasummService mediasummService = null; // 媒体service
	private List<Contract> contractList = null;// 合同list
	private LevelRuleService levelRuleService = null; // 阶梯service
	private MediumService mediumService = null; // 媒介service
	private String contractID = "";// 合同编号
	private String mediaType = "";// 媒体类型
	private String mediaName = "";// 媒体名称
	private File uploadFile_01 = null;// 媒体文件
	private String uploadFile_01FileName;
	private String uploadFile_01ContentType;
	private File uploadFile_02 = null;// 媒介文件
	private String uploadFile_02FileName;
	private String uploadFile_02ContentType;
	private List<Dictionary> mediaTypeList = null;// 媒体类型
	private List<Dictionary> mediaDiscountTypeList = null;// 媒体折扣类型
	private List<Dictionary> promotionATypeList = null;// 赠送使用类型
	private List<Dictionary> mediaBelogList = null;// 媒体归属
	private List<Dictionary> mediaResourceTypeList = null;// 媒体资源类型
	private List<MediaPrice> mpList = null;// 媒体list
	private List<Dictionary> shuXingList = null;// 媒介属性List
	private String uploadErrorMessage = "";// 媒体错误信息
	private String uploadErrorMessage_01 = "";// 媒介错误信息
	private String noError = "";
	private String noError_01 = "";
	private int priceID = 0;// 媒体价格ID

	// 跳转到媒体媒介导入页面
	public String toUploadMedia() {
		// 获取当前session对象中所属城市
		mediaType = "";
		UserInfo userInfo = (UserInfo) ServletActionContext.getRequest()
				.getSession().getAttribute(Constants.SESSIONPRKEY);
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		Date date = new Date();
		Contract contract1 = new Contract();
		contract1.setContractCity(userInfo.getUsercity());
		contract1.setContractStartTime(sf.format(date));// 开始时间
		contract1.setContractEndTime(sf.format(date));// 结束时间
		contractList = contractListService.findContractByYears(contract1);
		mediaTypeList = DatadicContext.getInstance().getDicDataListByCode(
				"MTLX");// 媒体类型
		return SUCCESS;
	}

	// 上传媒体并解析媒体Excel
	public String doUploadMedia() {

		String fliePath = "";// 上传文件路径
		String realpath = ServletActionContext.getServletContext().getRealPath(
				"/upload"); // 获得web应用的真实路径
		String fileName = StringUtils.getMathAndTime() + ".xlsx";
		File savefile = new File(realpath, fileName); // 参数1：保存路径，参数2：文件名
		try {
			FileUtils.copyFile(uploadFile_01, savefile);
		} catch (IOException e) {
			e.printStackTrace();
			return ERROR;
		}

		fliePath = realpath + "/" + fileName;
		try {
			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
			Date date = new Date();
			String nowDate = sf.format(date);
			UserInfo userInfo = (UserInfo) ServletActionContext.getRequest()
					.getSession().getAttribute(Constants.SESSIONPRKEY);
			String city = userInfo.getUsercity();// 归属地市
			mediaTypeList = DatadicContext.getInstance().getDicDataListByCode(
					"MTLX");// 媒体类型
			mediaDiscountTypeList = DatadicContext.getInstance()
					.getDicDataListByCode("MTZKLX");// 媒体折扣类型
			mediaResourceTypeList = DatadicContext.getInstance()
					.getDicDataListByCode("MTZYLX");// 媒体资源类型List
			mediaBelogList = DatadicContext.getInstance().getDicDataListByCode(
					"MTGS");// 媒体归属类型LIst
			promotionATypeList = DatadicContext.getInstance()
					.getDicDataListByCode("ZSSYLX");// 赠送使用类型
			Workbook workbook = null;
			try {
				workbook = this.create(new FileInputStream(fliePath));
			} catch (Exception e) {
				e.printStackTrace();
				this.deleteFile(fliePath);
				return ERROR;
			}

			Contract contract1 = new Contract();
			contract1.setContractID(contractID);

			List<Contract> contractList = contractListService
					.findContractByYears(contract1);// 查找是否有合同
			Contract contract = contractList.get(0);// 合同
			for (int k = 0; k < workbook.getNumberOfSheets(); k++) {
				Sheet sheet = workbook.getSheetAt(k);
				String sheetName = sheet.getSheetName(); // sheet名字
				int rows = sheet.getPhysicalNumberOfRows();
				for (int r = 1; r < rows; r++) {
					Row row = (Row) sheet.getRow(r);
					if (row == null) {
						break;
					}
					if (row != null) {
						int priceID;
						int mediaID;
						boolean bool = true;// 提示
						String mediaType = "";// 媒体类型
						String mediaDiscountType = "";// 折扣类型
						String promotionAType = "";// 随单赠送类型
						String promotionBType = "";// 常规赠送类型
						String promotionCType = "";// 返还赠送类型
						Mediasumm mediasumm = new Mediasumm();// 媒体实体
						MediaPrice mediaPrice = new MediaPrice();// 媒体价格实体
						if ("1".equals(contract.getContractBType())) {
							mediasumm.setMediaProvider(contract
									.getContractBName());// 供应商
						}
						if ("2".equals(contract.getContractBType())) {
							mediaPrice.setMediaAgent(contract
									.getContractBName());// 代理商
						}
						mediaPrice.setContractID(contractID);// 合同编号
						mediaPrice.setContractYear(contract.getContractYear());// 签约年份
						mediaPrice.setCity(contract.getContractCity());// 归属地市
						mediaPrice.setMediaPurchaseType(contract
								.getContractType());// 合同类型（媒体统购类型）
						mediaPrice.setMediaStartTime(contract
								.getContractStartTime());// 开始时间
						mediaPrice.setMediaEndTime(contract
								.getContractEndTime());// 结束时间
						mediasumm.setMediaName(getValue(row.getCell(0)).trim());// 媒体名称

						if ("".equals(mediasumm.getMediaName())
								|| StringUtils.getStringLength(mediasumm
										.getMediaName()) > 160) {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体名称不能为空或长度不能大于80(汉字)160字符！<br/>";
							bool = false;
						}

						if (!"".equals(mediasumm.getMediaName())
								&& StringUtils.StringFilter_Bool(contract
										.getContractBName())) {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体名称不能为空或不能含有特殊字符！<br/>";
							bool = false;
							continue;
						}

						List<MediaPrice> mediaPriceList = mediaPriceService
								.findMediaPriceByMediaIDOrName_01(mediasumm
										.getMediaName(), city, nowDate);
						if (mediaPriceList != null
								&& mediaPriceList.size() != 0) {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体名称重复！<br/>";
							bool = false;
							continue;
						}

						for (int i = 0; i < mediaTypeList.size(); i++) {
							String mediaTypeValue = getValue(row.getCell(1))
									.trim();
							if (!"".equals(mediaTypeValue)
									&& mediaTypeValue.length() < 30) {// 媒体类型
								if (mediaTypeValue.equals(mediaTypeList.get(i)
										.getDatavalue())
										|| mediaTypeList.get(i).getDatavalue()
												.trim() == mediaTypeValue) {
									mediaType = mediaTypeList.get(i).getId()
											+ "";
									break;
								}
							}
						}
						if (mediaType != null && !"".equals(mediaType)) {
							mediasumm.setMediaType(mediaType);// 媒体类型
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体类型错误！<br/>";
							bool = false;
						}

						mediasumm.setMediaDescription(getValue(row.getCell(2))
								.trim());// 媒体描述

						if (!"".equals(getValue(row.getCell(3)).trim())) {
							if (this.isFloathString(getValue(row.getCell(3))
									.trim())) {
								mediaPrice.setTotalPay(Float
										.parseFloat(getValue(row.getCell(3))
												.trim()));// 总金额
							} else {
								uploadErrorMessage += sheetName + ",第"
										+ (r + 1) + "行，总金额格式错误！<br/>";
								bool = false;
							}
						} else {
							mediaPrice.setTotalPay(Float.parseFloat("0"));// 总金额
						}

						for (int i = 0; i < mediaDiscountTypeList.size(); i++) {// 折扣类型
							if (getValue(row.getCell(4)).trim()
									.equals(
											mediaDiscountTypeList.get(i)
													.getDatavalue())
									&& !"".equals(getValue(row.getCell(4))
											.trim())) {
								mediaDiscountType = mediaDiscountTypeList
										.get(i).getId()
										+ "";
								break;
							}
						}
						if (!"".equals(mediaDiscountType)
								&& mediaDiscountType != null) {
							mediaPrice.setMediaDiscountType(mediaDiscountType);// 折扣类型
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，折扣类型不能为空或折扣类型不正确！<br/>";
							bool = false;
						}

						for (int i = 0; i < promotionATypeList.size(); i++) {// 随单赠送类型
							if (!"".equals(getValue(row.getCell(5)).trim())
									&& getValue(row.getCell(5)).trim().equals(
											promotionATypeList.get(i)
													.getDatavalue())) {
								promotionAType = promotionATypeList.get(i)
										.getId()
										+ "";
								break;
							}
						}
						if (!"".equals(promotionAType)
								&& promotionAType != null) {
							mediaPrice.setPromotionAType(Integer
									.parseInt(promotionAType));// 随单赠送类型
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，随单赠送类型不能为空或类型不正确！<br/>";
							bool = false;
						}
						if ("是".equals(getValue(row.getCell(6)).trim())
								&& !"".equals(getValue(row.getCell(6)).trim())) {// 随单赠送是否累计
							mediaPrice.setPromotionAAccumulat("1");
						} else if ("否".equals(getValue(row.getCell(6)).trim())
								&& !"".equals(getValue(row.getCell(6)).trim())) {// 随单赠送是否累计
							mediaPrice.setPromotionAAccumulat("2");
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，随单赠送是否累计不能为空或格式不正确！<br/>";
							bool = false;
						}

						// if (isValidDate(getValue(row.getCell(7)).trim()) &&
						// !"".equals(getValue(row.getCell(7)).trim())) {
						// mediaPrice.setPromotionALastValidDate(getValue(row.getCell(7)).trim());//
						// 随单赠送有效时间
						// }
						// else {
						// uploadErrorMessage += sheetName + ",第" + (r + 1) +
						// "行，随单赠送有效时间不能为空或者格式不正确！<br/>";
						// bool = false;
						// }

						mediaPrice.setPromotionALastValidDate(this
								.getNextYear());// 随单赠送有效时间

						if ("是".equals(getValue(row.getCell(7)).trim())
								&& !"".equals(getValue(row.getCell(7)).trim())) {// 随单赠送有效时间是否可调
							mediaPrice.setPromotionAValidDateAdjustable("1");
						} else if ("否".equals(getValue(row.getCell(7)).trim())
								&& !"".equals(getValue(row.getCell(7)).trim())) {
							mediaPrice.setPromotionAValidDateAdjustable("2");
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，随单赠送时间是否可调不能为空或格式不正确！<br/>";
							bool = false;
						}

						for (int i = 0; i < promotionATypeList.size(); i++) {// 常规赠送类型
							if (!"".equals(getValue(row.getCell(8)).trim())
									&& getValue(row.getCell(8)).trim().equals(
											promotionATypeList.get(i)
													.getDatavalue())) {
								promotionBType = promotionATypeList.get(i)
										.getId()
										+ "";
								break;
							}
						}
						if (!"".equals(promotionBType)
								&& promotionBType != null) {
							mediaPrice.setPromotionBType(promotionBType);// 常规赠送类型
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，常规赠送类型不能为空或格式不正确！<br/>";
							bool = false;
						}
						if ("是".equals(getValue(row.getCell(9)).trim())
								&& !"".equals(getValue(row.getCell(9)).trim())) {// 常规赠送是否累计
							mediaPrice.setPromotionBAccumulate("1");
						} else if ("否".equals(getValue(row.getCell(9)).trim())
								&& !"".equals(getValue(row.getCell(9)).trim())) {
							mediaPrice.setPromotionBAccumulate("2");
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，常规赠送是否累计不能为空或格式不正确！<br/>";
							bool = false;
						}

						// if (isValidDate(getValue(row.getCell(11)).trim()) &&
						// !"".equals(getValue(row.getCell(11)).trim())) {
						// mediaPrice.setPromotionBLastValidDate(getValue(row.getCell(11)));//
						// 常规赠送时间
						// }
						// else {
						// uploadErrorMessage += sheetName + ",第" + (r + 1) +
						// "行，常规赠送时间不能为空或者格式不正确！<br/>";
						// bool = false;
						// }

						mediaPrice.setPromotionBLastValidDate(this
								.getNextYear());// 常规赠送时间

						if (!"".equals(getValue(row.getCell(10)).trim())
								&& "是".equals(getValue(row.getCell(10)).trim())) {// 常规赠送时间是否可调
							mediaPrice.setPromotionBValidDateAdjustable("1");
						} else if (!"".equals(getValue(row.getCell(10)).trim())
								&& "否".equals(getValue(row.getCell(10)).trim())) {
							mediaPrice.setPromotionBValidDateAdjustable("2");
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，常规赠送时间是否可调不能为空或格式不正确！<br/>";
							bool = false;
						}

						for (int i = 0; i < promotionATypeList.size(); i++) {// 返还赠送类型
							if (!"".equals(getValue(row.getCell(11)).trim())
									&& getValue(row.getCell(11)).trim().equals(
											promotionATypeList.get(i)
													.getDatavalue())) {
								promotionCType = promotionATypeList.get(i)
										.getId()
										+ "";
								break;
							}
						}
						if (!"".equals(promotionCType)
								&& promotionCType != null) {
							mediaPrice.setPromotionCType(promotionCType);// 返还赠送类型
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，返还赠送类型不能为空或格式不正确！<br/>";
							bool = false;
						}

						if (!"".equals(getValue(row.getCell(12)))
								&& "是".equals(getValue(row.getCell(12)))) {// 返还有效时间是否可调
							mediaPrice.setPromotionCValidDateAdjustable("1");
						} else if (!"".equals(getValue(row.getCell(12)))
								&& "否".equals(getValue(row.getCell(12)))) {
							mediaPrice.setPromotionCValidDateAdjustable("2");
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，返还赠送时间是否可调不能为空或格式不正确！<br/>";
							bool = false;
						}

						// if (isValidDate(getValue(row.getCell(15)).trim()) &&
						// !"".equals(getValue(row.getCell(15)).trim())) {
						// mediaPrice.setPromotionCLastValidDate(getValue(row.getCell(15)));//
						// 返还赠送时间
						// }
						// else {
						// uploadErrorMessage += sheetName + ",第" + (r + 1) +
						// "行，返还赠送时间不能为空或者格式不正确！<br/>";
						// bool = false;
						// }

						mediaPrice.setPromotionCLastValidDate(this
								.getNextYear());// 返还赠送时间

						String mediaBelog = "";
						for (int i = 0; i < mediaBelogList.size(); i++) {// 媒体归属
							if (!"".equals(getValue(row.getCell(13)).trim())
									&& getValue(row.getCell(13)).trim().equals(
											mediaBelogList.get(i)
													.getDatavalue())) {
								mediaBelog = mediaBelogList.get(i).getId() + "";
								break;
							}
						}
						if (!"".equals(mediaBelog) && mediaBelog != null) {
							mediaPrice.setMediaBelog(mediaBelog);
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体归属不能为空或类型不正确！<br/>";
							bool = false;
						}

						String mediaResourceType = "";
						for (int i = 0; i < mediaResourceTypeList.size(); i++) {// 媒体资源类型
							if (!"".equals(getValue(row.getCell(14)).trim())
									&& getValue(row.getCell(14)).trim().equals(
											mediaResourceTypeList.get(i)
													.getDatavalue())) {
								mediaResourceType = mediaResourceTypeList
										.get(i).getId()
										+ "";
								break;
							}
						}
						if (mediaResourceType != null
								&& !"".equals(mediaResourceType)) {
							mediaPrice.setMediaResourceType(mediaResourceType);
						} else {
							uploadErrorMessage += sheetName + ",第" + (r + 1)
									+ "行，媒体资源类型不能为空或类型不正确！<br/>";
							bool = false;
						}

						List<LevelRule> lrList_01 = new ArrayList<LevelRule>();// 随单list
						List<LevelRule> lrList_02 = new ArrayList<LevelRule>();// 常规list
						List<LevelRule> lrList_03 = new ArrayList<LevelRule>();// 返还list并不是单一折扣

						// 阶梯
						String levelRuleStr = this.getValue(row.getCell(15))
								.trim();// 阶梯
						if (!"".equals(levelRuleStr) && levelRuleStr != null) {
							String[] levelRuleArr = levelRuleStr.split(",");
							outer: for (int i = 0; i < levelRuleArr.length; i++) {
								try {
									LevelRule levelRule = new LevelRule();
									String levelRuleStr1 = levelRuleArr[i];
									String[] aArr = levelRuleStr1.split("\\|");
									if (!"".equals(aArr[0])
											&& isNumberString(aArr[0])) {
										levelRule.setLevelLowerLimit(Float
												.parseFloat(aArr[0]));// 阶梯下限
									} else {
										uploadErrorMessage += sheetName + ",第"
												+ (r + 1) + "行，阶梯规则第" + (i + 1)
												+ "组,阶梯规则下限值不能为空或不是正整数！<br/>";
										bool = false;
									}
									if (!"".equals(aArr[1])
											&& isNumberString(aArr[1])) {
										levelRule.setLevelUpperLimit_01(String
												.valueOf(Float
														.parseFloat(aArr[1])));// 阶梯上限
									} else {
										uploadErrorMessage += sheetName + ",第"
												+ (r + 1) + "行，阶梯规则第" + (i + 1)
												+ "组，阶梯上限值不能为空或不是正整数！<br/>";
										bool = false;
									}

									if (Float.parseFloat(aArr[1])
											- Float.parseFloat(aArr[0]) < 0.0) {
										uploadErrorMessage += sheetName + ",第"
												+ (r + 1) + "行，阶梯规则第" + (i + 1)
												+ "组，阶梯上限值应大于下限值！<br/>";
										bool = false;
									}

									if (Float.parseFloat(aArr[1]) % 10000 != 0) {
										uploadErrorMessage += sheetName + ",第"
												+ (r + 1) + "行，阶梯规则第" + (i + 1)
												+ "组，阶梯上限值应大于1万并且是万的倍数！<br/>";
										bool = false;
									}

									if (!"".equals(aArr[2])
											&& isNumberString(aArr[2])
											&& "1".equals(aArr[2])) {
										levelRule.setLevelPromotionType("1");// 阶梯优惠类型：1，折扣。2，金额
									} else if (!"".equals(aArr[2])
											&& isNumberString(aArr[2])
											&& "2".equals(aArr[2])) {
										levelRule.setLevelPromotionType("2");// 阶梯优惠类型：1，折扣。2，金额
									} else {
										uploadErrorMessage += sheetName
												+ ",第"
												+ (r + 1)
												+ "行，阶梯规则第"
												+ (i + 1)
												+ "组，阶梯优惠类型不能为空或不是1:折扣、2:金额！<br/>";
										bool = false;
									}

									if (!"".equals(aArr[3])
											&& isFloathString(aArr[3])) {
										if ("1".equals(aArr[4])
												|| "1".equals(aArr[2])) {// 返还
											if (Float.parseFloat(aArr[3]) - 100 > 0
													|| Float
															.parseFloat(aArr[3]) < 0.0) {
												uploadErrorMessage += sheetName
														+ ",第"
														+ (r + 1)
														+ "行，阶梯规则第"
														+ (i + 1)
														+ "组，折扣额度必须大于0小于100！<br/>";
												bool = false;
											}
											if ("2".equals(aArr[2])
													&& "1".equals(aArr[4])) {
												uploadErrorMessage += sheetName
														+ ",第" + (r + 1)
														+ "行，阶梯规则第" + (i + 1)
														+ "组，阶梯优惠类型不能是金额！<br/>";
												bool = false;
											}
											levelRule
													.setLevelPromotionType("1");
											// levelRuleService.delLevelRuleByPriceID(priceID,
											// "1");
											// levelRule.setLevelUpperLimit_01(String.valueOf(Double.parseDouble("100000")
											// * 10000));// 上限值
											// levelRule.setLevelLowerLimit(0);//
											// 下限值
											// levelRule.setLevelID(0);// 阶梯编号
										}
										levelRule.setLevelDiscount(Float
												.parseFloat(aArr[3]));// 额度
									} else {
										uploadErrorMessage += sheetName + ",第"
												+ (r + 1) + "行，阶梯规则第" + (i + 1)
												+ "组，额度不能为空或不是数字！<br/>";
										bool = false;
									}
									if (!"".equals(aArr[4])
											&& isNumberString(aArr[4])) {
										if ("1".equals(aArr[4])) {
											levelRule.setSaleType("1");// 赠送类型：随单2，常规3，返还1
										} else if ("2".equals(aArr[4])) {
											levelRule.setSaleType("2");// 赠送类型：随单2，常规3，返还1
										} else if ("3".equals(aArr[4])) {
											levelRule.setSaleType("3");// 赠送类型：随单2，常规3，返还1
										} else {
											uploadErrorMessage += sheetName
													+ ",第"
													+ (r + 1)
													+ "行，阶梯规则第"
													+ (i + 1)
													+ "组，赠送类型是1:返还、2:随单、3:常规！<br/>";
											bool = false;
										}
									} else {
										uploadErrorMessage += sheetName
												+ ",第"
												+ (r + 1)
												+ "行，阶梯规则第"
												+ (i + 1)
												+ "组，赠送类型不能为空或不是1:返还、2:随单、3:常规！<br/>";
										bool = false;
									}

									levelRule.setContractYear(mediaPrice
											.getContractYear());// 年份
									if ("2".equals(levelRule.getSaleType())) {// 随单
										lrList_01.add(levelRule);
									}
									if ("3".equals(levelRule.getSaleType())) {// 常规
										lrList_02.add(levelRule);
									}
									if ("1".equals(levelRule.getSaleType())) {// 返还
										lrList_03.add(levelRule);
									}

									Comparator comp = new Comparator() {
										public int compare(Object o1, Object o2) {
											LevelRule lr1 = (LevelRule) o1;
											LevelRule lr2 = (LevelRule) o2;
											if (Float.parseFloat(lr1
													.getLevelUpperLimit_01()) > Float
													.parseFloat(lr2
															.getLevelUpperLimit_01()))
												return 1;
											else
												return 0;
										}
									};
									Collections.sort(lrList_01, comp);
									Collections.sort(lrList_02, comp);
									Collections.sort(lrList_03, comp);

									if (bool) {
										if (lrList_01 != null
												&& lrList_01.size() != 0) {
											for (int j = 0; j < lrList_01
													.size(); j++) {
												if (j > 0) {
													if (Double
															.parseDouble(lrList_01
																	.get(j - 1)
																	.getLevelUpperLimit_01())
															- lrList_01
																	.get(j)
																	.getLevelLowerLimit() != 0) {
														uploadErrorMessage += sheetName
																+ ",第"
																+ (r + 1)
																+ "行，随单的阶梯规则第"
																+ (j + 1)
																+ "组，当前最小值不等于上组最大值！<br/>";
														bool = false;
														break outer;
													}
												}
												if (!lrList_01
														.get(0)
														.getLevelPromotionType()
														.equals(
																lrList_01
																		.get(j)
																		.getLevelPromotionType())) {
													uploadErrorMessage += sheetName
															+ ",第"
															+ (r + 1)
															+ "行，随单的阶梯规则第"
															+ (j + 1)
															+ "组，当前阶梯优惠类型不统一！<br/>";
													bool = false;
													break outer;
												}

											}
										}
									}

									if (lrList_02 != null
											&& lrList_02.size() != 0) {
										for (int j = 0; j < lrList_02.size(); j++) {
											if (lrList_02.get(j) != null) {
												if (j > 0) {
													// System.out.println(lrList_02.get(j-1).getLevelUpperLimit_01());
													if (Double
															.parseDouble(lrList_02
																	.get(j - 1)
																	.getLevelUpperLimit_01())
															- lrList_02
																	.get(j)
																	.getLevelLowerLimit() != 0) {
														uploadErrorMessage += sheetName
																+ ",第"
																+ (r + 1)
																+ "行，常规的阶梯规则第"
																+ (j + 1)
																+ "组，当前最小值不等于上组最大值！<br/>";
														bool = false;
														break outer;
													}
												}
												if (!lrList_02
														.get(0)
														.getLevelPromotionType()
														.equals(
																lrList_02
																		.get(j)
																		.getLevelPromotionType())) {
													uploadErrorMessage += sheetName
															+ ",第"
															+ (r + 1)
															+ "行，常规的阶梯规则第"
															+ (j + 1)
															+ "组，当前阶梯优惠类型不统一！<br/>";
													bool = false;
													break outer;
												}
											}
										}
									}

									for (int j = 0; j < lrList_03.size(); j++) {
										if (j > 0) {
											if (lrList_03.get(j) != null) {
												if (Double
														.parseDouble(lrList_03
																.get(j - 1)
																.getLevelUpperLimit_01())
														- lrList_03
																.get(j)
																.getLevelLowerLimit() != 0) {
													uploadErrorMessage += sheetName
															+ ",第"
															+ (r + 1)
															+ "行，返还的阶梯规则第"
															+ (j + 1)
															+ "组，当前最小值不等于上组最大值！<br/>";
													bool = false;
													break outer;
												}
											}
											if (!lrList_03.get(j)
													.getLevelPromotionType()
													.equals("1")) {
												uploadErrorMessage += sheetName
														+ ",第"
														+ (r + 1)
														+ "行，返还的阶梯规则第"
														+ (j + 1)
														+ "组，当前阶梯优惠类型不是折扣！<br/>";
												bool = false;
												break outer;
											}
										}
									}
								} catch (Exception e) {
									bool = false;
								}
							}
							if (bool) {
								mediaID = mediasummService
										.addMediasumm(mediasumm);// 添加媒体
								mediaPrice.setMediaID(mediaID);
								priceID = mediaPriceService
										.addMediaPrice(mediaPrice);// 添加媒体价格

								List<LevelRule> lrList_1 = levelRuleService
										.findLevelRuleByPriceIDAndType(priceID,
												"2");// 随单list
								List<LevelRule> lrList_2 = levelRuleService
										.findLevelRuleByPriceIDAndType(priceID,
												"3");// 常规list
								List<LevelRule> lrList_3 = levelRuleService
										.findLevelRuleByPriceIDAndType(priceID,
												"1");// 返还list

								if (lrList_1.size() != lrList_01.size()) {// 添加随单
									levelRuleService.delLevelRuleByPriceID(
											priceID, "2");// 删除阶梯
									for (int i = 0; i < lrList_01.size(); i++) {
										// 添加阶梯
										LevelRule lr = lrList_01.get(i);
										lr.setLevelID(i + 1);
										lr.setPriceID(priceID);// 媒体价格ID
										lr.setMediaID(mediaID);// 媒体编号
										levelRuleService.addLevelRule(lr);
									}
								}
								if (lrList_2.size() != lrList_02.size()) {// 添加随单
									levelRuleService.delLevelRuleByPriceID(
											priceID, "3");// 删除阶梯
									for (int i = 0; i < lrList_02.size(); i++) {
										// 添加阶梯
										LevelRule lr = lrList_02.get(i);
										lr.setLevelID(i + 1);
										lr.setPriceID(priceID);// 媒体价格ID
										lr.setMediaID(mediaID);// 媒体编号
										levelRuleService.addLevelRule(lr);
									}
								}

								if (lrList_3.size() != lrList_03.size()) {// 添加随单
									levelRuleService.delLevelRuleByPriceID(
											priceID, "1");// 删除阶梯
									for (int i = 0; i < lrList_03.size(); i++) {
										if ("1".equals(mediaPrice
												.getMediaDiscountType())) {// 单一折扣
											LevelRule lr = lrList_03.get(i);
											lr
													.setLevelUpperLimit_01(String
															.valueOf(Double
																	.parseDouble("100000") * 10000));// 上限值
											lr.setLevelLowerLimit(0);// 下限值
											lr.setLevelID(0);// 阶梯编号
											lr.setPriceID(priceID);// 媒体价格ID
											lr.setMediaID(mediaID);// 媒体编号
											levelRuleService.addLevelRule(lr);
											break;
										} else {
											// 添加阶梯
											LevelRule lr = lrList_03.get(i);
											lr.setLevelID(i + 1);
											lr.setPriceID(priceID);// 媒体价格ID
											lr.setMediaID(mediaID);// 媒体编号
											levelRuleService.addLevelRule(lr);
										}
									}
								}
							}
						}
					}
				}
			}
			// System.out.println(uploadErrorMessage);
			if ("".equals(uploadErrorMessage)) {
				noError = "noError";
			}
			this.deleteFile(fliePath);
		} catch (Exception e) {
			e.printStackTrace();
			this.deleteFile(fliePath);
			return ERROR;
		}
		return SUCCESS;
	}

	/**
	 * 根据媒体类型查找媒体
	 * 
	 * @return
	 */
	public String findMediumByMediumType() {
		UserInfo userInfo = (UserInfo) ServletActionContext.getRequest()
				.getSession().getAttribute(Constants.SESSIONPRKEY);
		String city = userInfo.getUsercity();// 归属地市
		if (!"".equals(mediaType)) {
			mpList = mediaPriceService.findMediaPriceByMediaIDOrName(null,
					mediaName, mediaType, city);
		}
		return SUCCESS;
	}

	/**
	 * 导入媒介
	 * 
	 * @return
	 */
	public String doUploadMedium() {
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		String nowTime = sf.format(date);
		List<MediaPrice> mpList = mediaPriceService
				.findAllMediaPriceByPriceID(priceID);
		MediaPrice mediaPrice = null;
		if (mpList != null && mpList.size() != 0) {
			mediaPrice = mpList.get(0);
		}
		String fliePath = "";// 上传文件路径
		String realpath = ServletActionContext.getServletContext().getRealPath(
				"/upload"); // 获得web应用的真实路径
		String fileName = StringUtils.getMathAndTime() + ".xlsx";
		File savefile = new File(realpath, fileName); // 参数1：保存路径，参数2：文件名
		try {
			FileUtils.copyFile(uploadFile_02, savefile);
		} catch (IOException e) {
			e.printStackTrace();
			this.deleteFile(fliePath);
			return ERROR;
		}

		fliePath = realpath + "/" + fileName;
		try {

			Workbook workbook = null;
			try {
				workbook = this.create(new FileInputStream(fliePath));
			} catch (Exception e) {
				e.printStackTrace();
				this.deleteFile(fliePath);
				return ERROR;
			}
			Dictionary dictionary = DatadicContext.getInstance()
					.getDatadicObject(mediaType, "MTLX");// 媒体类型
			for (int k = 0; k < workbook.getNumberOfSheets(); k++) {
				Sheet sheet = workbook.getSheetAt(k);
				String sheetName = sheet.getSheetName(); // sheet名字
				int rows = sheet.getPhysicalNumberOfRows();
				Row row_first = (Row) sheet.getRow(0);
				// System.out.println(dictionary.getDatavalue() + "_" +
				// mediaType + "_" + sheetName);
				if (!"".equals(mediaType)
						&& !sheetName.equals(dictionary.getDatavalue())
						&& row_first != null) {// 媒体类型
					uploadErrorMessage_01 += sheetName
							+ "，媒体类型与导入刊例类型不一致！<br/>";
					continue;
				}
				for (int r = 1; r < rows; r++) {
					Row row = (Row) sheet.getRow(r);
					if (row != null) {
						// 媒介公共属性
						int j = 0;
						boolean bool = true;
						StringBuffer sb = new StringBuffer();// key
						StringBuffer sb1 = new StringBuffer();// value
						List<Medium> mList = null;// 媒介list
						sb.append("priceID" + ",");// 媒体价格ID的key
						sb1.append(priceID + ",");// 媒体价格ID的Value
						sb.append("mediumID,");// 媒介编号
						sb1.append("'" + StringUtils.getMathAndTime() + "',");// 媒介编号
						sb.append("mediaID,");// 媒体编号
						sb1.append("'" + mediaPrice.getMediaID() + "',");// 媒体编号

						if (!"".equals(getValue(row.getCell(0)).trim())
								&& StringUtils.StringFilter_Bool(getValue(
										row.getCell(0)).trim())) {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例名称不能包含特殊字符！<br/>";
							continue;
						}

						if (!"".equals(getValue(row.getCell(0)).trim())
								&& StringUtils.getStringLength(getValue(
										row.getCell(0)).trim()) < 100) {
							mList = mediumService
									.findMediumByMediumName(getValue(
											row.getCell(0)).trim());
							if (mList != null && mList.size() != 0) {
								uploadErrorMessage_01 += sheetName + ",第"
										+ (r + 1) + "行， 刊例名称重复！<br/>";
								continue;
							} else {
								sb.append("mediumName,");// 媒介名称
								sb1.append("'"
										+ getValue(row.getCell(0)).trim()
										+ "',");
							}
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例名称不能为空或长度不能50(汉字)100字符！<br/>";
							continue;
						}

						sb.append("contractYear,");// 年份
						sb1.append("'" + mediaPrice.getContractYear() + "',");

						if (!"".equals(getValue(row.getCell(1)).trim())
								&& isFloathString(getValue(row.getCell(1))
										.trim())) {
							sb.append("mediumPrice,");// 刊例价
							sb1.append(Float
									.parseFloat(getValue(row.getCell(1))
											.toString())
									+ ",");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例价不能为空或格式不是数字！<br/>";
							bool = false;
						}
						if (!"".equals(getValue(row.getCell(2)).trim())
								&& isFloathString(getValue(row.getCell(2))
										.trim())
								&& Float.parseFloat(getValue(row.getCell(2))
										.trim()) - 255 <= 0.0) {
							sb.append("mediumAbility,");// 媒介能力
							sb1.append(getValue(row.getCell(2)).trim() + ",");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例能力不能为空或格式不是小于255的整数！<br/>";
							bool = false;
						}

						String mediumPromotionType = "1";// 媒介赠送类型
						if (!"".equals(getValue(row.getCell(3)).trim())
								&& getValue(row.getCell(3)).trim().equals("赠送")) {
							mediumPromotionType = "1";
						} else if (!"".equals(getValue(row.getCell(3)).trim())
								&& getValue(row.getCell(3)).trim()
										.equals("非赠送")) {
							mediumPromotionType = "2";
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例赠送类型不能为空或格式错误！<br/>";
							bool = false;
						}
						sb.append("mediumPromotionType,");// 媒介赠送类型
						sb1.append("'" + mediumPromotionType + "',");

						if (isFloathString(getValue(row.getCell(4)).trim())) {
							sb.append("mediumNumber,");// 媒介数量
							sb1.append("'" + getValue(row.getCell(4)).trim()
									+ "',");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例数量格式不是整数！<br/>";
							bool = false;
						}
						if (StringUtils
								.getStringLength(getValue(row.getCell(5))
										.trim()) < 160) {
							sb.append("mediumUnit,");// 媒介单位
							sb1.append("'" + getValue(row.getCell(5)).trim()
									+ "',");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例单位长度不能大于80(汉字)160字符！<br/>";
							bool = false;
						}
						if (isFloathString(getValue(row.getCell(6)).trim())) {
							if (Integer.parseInt(getValue(row.getCell(6))
									.trim()) - 100 > 0) {
								uploadErrorMessage_01 += sheetName + ",第"
										+ (r + 1)
										+ "行， 刊例加收比率不是大于0小于100的正整数！<br/>";
								bool = false;
							} else {
								sb.append("surchargesRatio,");// 比率
								sb1.append(getValue(row.getCell(6)).trim()
										+ ",");
							}
						} else {
							sb.append("surchargesRatio,");// 比率
							sb1.append(0 + ",");
						}
						if (StringUtils
								.getStringLength(getValue(row.getCell(7))
										.trim()) < 160) {
							sb.append("mediumDuration,");// 上画时长
							sb1.append("'" + getValue(row.getCell(7)).trim()
									+ "',");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 上画时长长度不能大于80(汉字)160字符！<br/>";
							bool = false;
						}
						sb.append("mediumArrangement,");// 排期
						sb1.append("'"
								+ this.findMediumArrangement(mediaPrice
										.getContractYear()) + "',");
						if (StringUtils
								.getStringLength(getValue(row.getCell(8))
										.trim()) < 160) {
							sb.append("mediumDescription,");// 媒介简要介绍
							sb1.append("'" + getValue(row.getCell(8)).trim()
									+ "',");
						} else {
							uploadErrorMessage_01 += sheetName + ",第" + (r + 1)
									+ "行， 刊例简要介绍不能大于80(汉字)160字符！<br/>";
							bool = false;
						}
						sb.append("modifyTime,");// 修改时间
						sb1.append("'" + nowTime + "',");

						Dictionary dic = new Dictionary();
						dic.setParentId(Integer.valueOf(mediaType));
						dic.setClasscode("MJZDPZ");
						dic.setExtAttr2_01("order_by");// 用于排序
						shuXingList = dictionaryService.findAll(dic);// 媒介属性LIst
						sb.append("mediaType");// 媒体类型
						sb1.append("'" + mediaType + "'");// 媒体类型
						for (int i = 9; i < shuXingList.size() + 9; i++) {
							if (!"".equals(getValue(row_first.getCell(i))
									.trim())
									&& getValue(row_first.getCell(i)).trim()
											.equals(
													shuXingList.get(j)
															.getDatavalue()
															.trim())) {
								if (StringUtils.getStringLength(getValue(
										row.getCell(i)).trim()) > 160) {
									uploadErrorMessage_01 += sheetName + ",第"
											+ (row.getRowNum() + 1) + "行， "
											+ shuXingList.get(j).getDatavalue()
											+ "，长度不能大于80(汉字)160字符！<br/>";
									bool = false;
								}
								if ("1"
										.equals(shuXingList.get(j)
												.getExtAttr1())) {
									if (isFloathString(getValue(row.getCell(i))
											.trim())) {
										sb.append(","
												+ shuXingList.get(j).getId());
										sb1.append(",'"
												+ getValue(row.getCell(i))
														.trim() + "'");
									} else {
										uploadErrorMessage_01 += sheetName
												+ ",第"
												+ (row.getRowNum() + 1)
												+ "行， "
												+ shuXingList.get(j)
														.getDatavalue()
												+ "，不是正整数！<br/>";
										bool = false;
									}
								} else {
									sb.append("," + shuXingList.get(j).getId());
									sb1.append(",'"
											+ getValue(row.getCell(i)).trim()
											+ "'");

								}
							}
							j++;
						}
						if (bool) {
							if (mList == null || mList.size() == 0) {
								String sql = "insert into T_CB_MEDIUM("
										+ sb.toString() + ") values("
										+ sb1.toString() + ")";// 媒介
								System.out.println(sql);
								try {
									BaseDAO.executeSQL(sql, null);
								} catch (Exception e) {
									e.printStackTrace();
									this.deleteFile(fliePath);
									return ERROR;
								}
							}
						}
					}
				}
			}
			// System.out.println(uploadErrorMessage_01);
			if ("".equals(uploadErrorMessage_01)) {
				noError_01 = "noError_01";
			}
			this.deleteFile(fliePath);

		} catch (Exception e) {
			e.printStackTrace();
			this.deleteFile(fliePath);
			return ERROR;
		}
		return SUCCESS;
	}

	/**
	 * 排期
	 * 
	 * @param year
	 * @return
	 */
	private String findMediumArrangement(String year) {
		// 日历
		Calendar c = Calendar.getInstance();
		c.clear();
		// 设置年度
		c.set(Calendar.YEAR, (Integer.parseInt(year) + 1900));
		// 初始化
		StringBuffer sb = new StringBuffer();
		// 循环
		for (int i = 0; i < c.getActualMaximum(Calendar.DAY_OF_YEAR); i++) {
			sb.append("," + 0);
		}
		return sb.toString().substring(1);
	}

	private Workbook create(InputStream inp) throws IOException,
			InvalidFormatException {
		if (!inp.markSupported()) {
			inp = new PushbackInputStream(inp, 8);
		}
		if (POIFSFileSystem.hasPOIFSHeader(inp)) {
			return new HSSFWorkbook(inp);
		}
		if (POIXMLDocument.hasOOXMLHeader(inp)) {
			return new XSSFWorkbook(OPCPackage.open(inp));
		}
		throw new IllegalArgumentException("你的excel版本目前poi解析不了");
	}

	/**
	 * 得到Excel表中的值
	 * 
	 * @param hssfCell
	 *            Excel中的每一个格子
	 * @return Excel中每一个格子中的值
	 */
	public String getValue(Cell hssfCell) {
		if (hssfCell == null) {
			return "";
		}
		if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) {
			// 返回布尔类型的值
			return String.valueOf(hssfCell.getBooleanCellValue()).trim();
		}
		if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
			if (HSSFDateUtil.isCellDateFormatted(hssfCell)) {
				SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
				Date dt = HSSFDateUtil.getJavaDate(hssfCell
						.getNumericCellValue());
				return dateformat.format(dt).trim();
			} else {
				// 返回数值类型的值
				String str = String.valueOf(hssfCell.getNumericCellValue())
						.trim();
				if (isFloathString(str)) {
					double num = Double.parseDouble("0"
							+ str.substring(str.indexOf(".")));
					if (num == 0.0) {
						int num2 = Integer.parseInt(str.substring(0, str
								.indexOf(".")));
						return String.valueOf(num2);
					} else {
						return str;
					}
				}
			}
		}
		// 返回字符串类型的值
		return String.valueOf(hssfCell.getStringCellValue()).trim();
	}

	/**
	 * 删除单个文件
	 * 
	 * @param sPath
	 *            被删除文件的文件名
	 * @return 单个文件删除成功返回true，否则返回false
	 */
	public boolean deleteFile(String sPath) {
		boolean flag = false;
		File file = new File(sPath);
		// 路径为文件且不为空则进行删除
		if (file.isFile() && file.exists()) {
			file.delete();
			flag = true;
		}
		return flag;
	}

	/**
	 * 判断是否日期
	 * 
	 * @param s
	 * @return
	 */
	private boolean isValidDate(String s) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		dateFormat.setLenient(false);
		try {
			dateFormat.parse(s);
			return true;
		} catch (Exception e) {
			// 如果throw java.text.ParseException或者NullPointerException，就说明格式不对
			return false;
		}
	}

	private String getNextYear() {
		Date date = new Date();
		SimpleDateFormat sf1 = new SimpleDateFormat("yyyy");
		String nextYear = String
				.valueOf(Integer.parseInt(sf1.format(date)) + 1);
		SimpleDateFormat sf2 = new SimpleDateFormat("MM-dd");
		String nextYears = nextYear + "-" + sf2.format(date);
		return nextYears;
	}

	/**
	 * 判断float类型
	 * 
	 * @param testString
	 * @return
	 */
	private boolean isNumberString(String testString) {
		String numAllString = "0123456789";
		if (testString.length() <= 0)
			return false;
		for (int i = 0; i < testString.length(); i++) {
			String charInString = testString.substring(i, i + 1);
			if (!numAllString.contains(charInString))
				return false;
		}
		return true;
	}

	public boolean isFloathString(String testString) {
		if (!testString.contains(".")) {
			return isNumberString(testString);
		} else {
			String[] floatStringPartArray = testString.split("\\.");
			if (floatStringPartArray.length == 2) {
				if (isNumberString(floatStringPartArray[0]) == true
						&& isNumberString(floatStringPartArray[1]) == true)
					return true;
				else
					return false;
			} else
				return false;

		}
	}

	public File getUploadFile_01() {
		return uploadFile_01;
	}

	public void setUploadFile_01(File uploadFile_01) {
		this.uploadFile_01 = uploadFile_01;
	}

	public String getUploadFile_01FileName() {
		return uploadFile_01FileName;
	}

	public void setUploadFile_01FileName(String uploadFile_01FileName) {
		this.uploadFile_01FileName = uploadFile_01FileName;
	}

	public String getUploadFile_01ContentType() {
		return uploadFile_01ContentType;
	}

	public void setUploadFile_01ContentType(String uploadFile_01ContentType) {
		this.uploadFile_01ContentType = uploadFile_01ContentType;
	}

	public void setMediaPriceService(MediaPriceService mediaPriceService) {
		this.mediaPriceService = mediaPriceService;
	}

	public void setMediasummService(MediasummService mediasummService) {
		this.mediasummService = mediasummService;
	}

	public List<Contract> getContractList() {
		return contractList;
	}

	public void setContractList(List<Contract> contractList) {
		this.contractList = contractList;
	}

	public void setContractListService(ContractListService contractListService) {
		this.contractListService = contractListService;
	}

	public String getContractID() {
		return contractID;
	}

	public void setContractID(String contractID) {
		this.contractID = contractID;
	}

	public void setLevelRuleService(LevelRuleService levelRuleService) {
		this.levelRuleService = levelRuleService;
	}

	public String getUploadErrorMessage() {
		return uploadErrorMessage;
	}

	public void setUploadErrorMessage(String uploadErrorMessage) {
		this.uploadErrorMessage = uploadErrorMessage;
	}

	public String getNoError() {
		return noError;
	}

	public void setNoError(String noError) {
		this.noError = noError;
	}

	public List<Dictionary> getMediaTypeList() {
		return mediaTypeList;
	}

	public void setMediaTypeList(List<Dictionary> mediaTypeList) {
		this.mediaTypeList = mediaTypeList;
	}

	public List<MediaPrice> getMpList() {
		return mpList;
	}

	public void setMpList(List<MediaPrice> mpList) {
		this.mpList = mpList;
	}

	public String getMediaType() {
		return mediaType;
	}

	public void setMediaType(String mediaType) {
		this.mediaType = mediaType;
	}

	public String getMediaName() {
		return mediaName;
	}

	public void setMediaName(String mediaName) {
		this.mediaName = mediaName;
	}

	public int getPriceID() {
		return priceID;
	}

	public void setPriceID(int priceID) {
		this.priceID = priceID;
	}

	public File getUploadFile_02() {
		return uploadFile_02;
	}

	public void setUploadFile_02(File uploadFile_02) {
		this.uploadFile_02 = uploadFile_02;
	}

	public String getUploadFile_02FileName() {
		return uploadFile_02FileName;
	}

	public void setUploadFile_02FileName(String uploadFile_02FileName) {
		this.uploadFile_02FileName = uploadFile_02FileName;
	}

	public String getUploadFile_02ContentType() {
		return uploadFile_02ContentType;
	}

	public void setUploadFile_02ContentType(String uploadFile_02ContentType) {
		this.uploadFile_02ContentType = uploadFile_02ContentType;
	}

	public void setMediumService(MediumService mediumService) {
		this.mediumService = mediumService;
	}

	public void setDictionaryService(DictionaryService dictionaryService) {
		this.dictionaryService = dictionaryService;
	}

	public String getUploadErrorMessage_01() {
		return uploadErrorMessage_01;
	}

	public void setUploadErrorMessage_01(String uploadErrorMessage_01) {
		this.uploadErrorMessage_01 = uploadErrorMessage_01;
	}

	public String getNoError_01() {
		return noError_01;
	}

	public void setNoError_01(String noError_01) {
		this.noError_01 = noError_01;
	}

}
